function myNew(Fn, ...args) {
    if(typeof Fn != "function") {
        throw Error("构造函数必须是一个函数")
    }
    // const obj = Object.create(Fn.prototype);
    const obj = {}
    obj.__proto__ = Fn.prototype
    const res = Fn.apply(obj, args);
    if(res instanceof Object) {
        return res
    }
    else {
        return obj
    }
}

function demo(a) {
    this.a = a;
}

console.log(myNew(demo, 1) instanceof demo)
console.log(Function instanceof Object)